<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* 父盒子 */
        .fq{
            position: relative;
            width: 100%;
            height: 300px;
            background-color: skyblue;
        }
        /* 子盒子 */
        .ez{
            position: absolute;
            background: #00ff00;
            width: 100px;
            height: 100px;
            left: 50%;
            transform: translate(-50%);
            text-align: center;
        }
    </style>
</head>
<body>
    <div class="fq">
        <div class="ez">方法三</div>
    </div>
</body>
</html>